<% content_for :sidebar do %>
  <%= sidebar_button_link 'New Course', new_course_path if can? :create, Course %>
<% end %>

<table id="courses" class="datatable table table-striped table-bordered" >
  <caption><h3><%= @page_title %></h3></caption>
  <thead>
    <tr>
      <th>Title</th>
      <th>Description</th>
      <th>Category</th>
      <th>Duration</th>
      <th>Term</th>
      <th>Status</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @courses.each do |course| %>
      <tr>
        <td><%= link_to course.name, course %></td>
        <td><%= course.description %></td>
        <td><%= course.category %></td>
        <td><%= course.duration %></td>
        <td><%= course.term %></td>
        <td><%= course.status %></td>
        <td><%= table_button_link 'Edit', edit_course_path(course) %></td>
      </tr>
    <% end %>
  </tbody>
</table>
